package com.hunliji.monitor.manager.api;

import com.alibaba.fastjson.JSONObject;
import com.hunliji.monitor.manager.api.model.dto.FeiShuSendMsgDTO;
import com.hunliji.monitor.manager.api.model.dto.FeishuUserInfoDTO;
import com.hunliji.monitor.manager.api.model.dto.ObtainAccessTokenDTO;
import com.hunliji.monitor.manager.api.model.dto.ObtainChatGroupDTO;
import com.hunliji.monitor.manager.api.model.dto.ObtainChatGroupMemberDTO;
import com.hunliji.monitor.manager.api.model.param.FeiShuSendMsgManagerParam;
import com.hunliji.monitor.manager.api.model.param.ObtainAccessTokenManagerParam;
import com.lark.project.core.request.RequestOptions;
import com.lark.project.service.workitem.builder.CreateWorkItemReq;

import java.util.List;
import java.util.Map;

/**
 * 飞书接口的接入
 * @author wuchen
 */
public interface FeiShuManager {
    /**
     * 获取token
     * @param obtainAccessTokenManagerParam
     * @return
     */
    ObtainAccessTokenDTO obtainToken(ObtainAccessTokenManagerParam obtainAccessTokenManagerParam);

    /**
     * 获取全部的群组，这个群组应该不会多
     * @param accessToken：accessToken
     * @return
     */
    List<ObtainChatGroupDTO> obtainChatGroupAll(String accessToken);

    /**
     * 获取全部的群组成员
     * @param accessToken：accessToken
     * @param chatGroupId:飞书的群组id
     * @return
     */
    List<ObtainChatGroupMemberDTO> obtainChatGroupMemberAll(String accessToken, String chatGroupId);

    /**
     * 发送飞书群组消息
     * @param receiveChatId：接收的群ID
     * @param content：接收的消息体
     * @param accessToken:token
     * @return
     */
    FeiShuSendMsgDTO sendChatGroupMsg(String receiveChatId,String content,String accessToken);

    /**
     * 发送飞书消息
     * @param param
     * @param accessToken
     * @return
     */
    FeiShuSendMsgDTO sendMsg(FeiShuSendMsgManagerParam param,String accessToken);

    /**
     * 飞书消息加急
     * @param userIdList
     * @param messageId
     * @return
     */
    List<String> urgentApp(List<String> userIdList,String messageId,String accessToken);

    /**
     * 飞书电话加急
     */
    List<String> urgentPhone(List<String> userIdList,String messageId,String accessToken);

    /**
     * 获取用户信息
     * @param userId
     * @param userIdType
     * @param departmentIdType
     * @param accessToken
     * @return
     */
    FeishuUserInfoDTO getUserInfo(String userId,String userIdType,String departmentIdType,String accessToken);


    boolean sendRobotMessage(String robotToken, JSONObject param);

    public void createItem(CreateWorkItemReq createWorkItemReq, String accessToken) throws Exception;

    void createItemV2(Map<String, Object> paramMap, String accessToken, String projectKey);
}
